<%@page import="java.io.Serializable"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"
    pageEncoding="utf-8"%>
<%@ page import="net.sf.ehcache.*"%>
<jsp:useBean id="cache" type="net.sf.ehcache.Cache" scope="application" />
<%
    String key = request.getParameter("key");
%>
<form>
    <h3>
        Cache Region:
        <%=cache.getName()%></h3>
    <table>
        <tr>
            <th>Key
            <th>
            <td><input type='text' name='key'
                value='<%=((key != null) ? key : "name")%>' /></td>
        </tr>
        <tr>
            <td colspan='2'><input type='submit' value='Read Cache' />
                <%
                    if (key != null && key.length() > 0) {
                        Element cache_obj = cache.get(key);
                        out.print((cache_obj == null) ? "null" : cache_obj.getObjectValue());
                        if (cache != null) {
                            out.println(cache_obj);
                        }
                    }
                %>
            </td>
        </tr>
    </table>
</form>

<p>
    <a href="index.jsp">Back to Index</a>
</p>